package com.ampaiva.organizescreen.activity;

import android.graphics.Canvas;
import android.graphics.Color;

import com.ampaiva.organizescreen.model.Connection;
import com.ampaiva.organizescreen.model.Node;
import com.ampaiva.organizescreen.model.Puzzle;

public class PuzzleDrawer {
	private final Puzzle puzzle;
	private final NodeDrawer nodeDrawer = new NodeDrawer();
	private final ConnectionDrawer connectionDrawer = new ConnectionDrawer();

	public PuzzleDrawer(Puzzle puzzle) {
		this.puzzle = puzzle;
	}

	public void draw(Canvas canvas) {
		canvas.drawColor(Color.BLACK);
		for (Node node : getPuzzle().getNodes())
			nodeDrawer.draw(canvas, node);
		for (Connection connection : getPuzzle().getConnections())
			connectionDrawer.draw(canvas, connection);
	}

	public Puzzle getPuzzle() {
		return puzzle;
	}

}
